
const deepClone = (obj) => {
    let newObj = obj.constructor === Array ? [] : {}
    for (let i in obj) {
        newObj[i] = typeof obj[i] == 'object' ? deepClone(obj[i]) : obj[i];
    }
    console.log(newObj);
    return newObj;
}

let obj = {
    name: 'zhangsan',
    age: 18,
    address: {
        province: 'beijing',
        city: 'shanghai'
    }
}

deepClone(obj);


function clone(obj) {
    let newobj = obj.constructor == Array ? []:{};
    for (let i in obj) {
        newobj[i] = typeof obj[i] == 'object' ? clone(obj[i]) : obj[i];
    }
    return newobj;
}

(function() {
    console.log('lijizhixing ')
})()